Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / svx / source / svdraw / svdoutl.cxx
blob970f09b065107dd56be58415d8204cf1c959f5fa
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <svx/svdoutl.hxx>
21 #include <editeng/outliner.hxx>
22 #include <svx/svdotext.hxx>
23 #include <editeng/editstat.hxx>
24 #include <svx/svdmodel.hxx>
25 #include <editeng/eeitem.hxx>
26 #include <svl/itempool.hxx>
29 SdrOutliner::SdrOutliner( SfxItemPool* pItemPool, sal_uInt16 nMode )
30 : Outliner( pItemPool, nMode ),
31 //mpPaintInfoRec( NULL )
32 mpVisualizedPage(0)
37 SdrOutliner::~SdrOutliner()
42 void SdrOutliner::SetTextObj( const SdrTextObj* pObj )
44 if( pObj && pObj != mpTextObj.get() )
46 SetUpdateMode(false);
47 sal_uInt16 nOutlinerMode2 = OUTLINERMODE_OUTLINEOBJECT;
48 if ( !pObj->IsOutlText() )
49 nOutlinerMode2 = OUTLINERMODE_TEXTOBJECT;
50 Init( nOutlinerMode2 );
52 SetGlobalCharStretching(100,100);
54 sal_uIntPtr nStat = GetControlWord();
55 nStat &= ~( EE_CNTRL_STRETCHING | EE_CNTRL_AUTOPAGESIZE );
56 SetControlWord(nStat);
58 Size aNullSize;
59 Size aMaxSize( 100000,100000 );
60 SetMinAutoPaperSize( aNullSize );
61 SetMaxAutoPaperSize( aMaxSize );
62 SetPaperSize( aMaxSize );
63 ClearPolygon();
66 mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
69 void SdrOutliner::SetTextObjNoInit( const SdrTextObj* pObj )
71 mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
74 OUString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos,
75 Color*& rpTxtColor, Color*& rpFldColor)
77 bool bOk = false;
78 OUString aRet;
80 if(mpTextObj.is())
81 bOk = static_cast< SdrTextObj* >( mpTextObj.get())->CalcFieldValue(rField, nPara, nPos, false, rpTxtColor, rpFldColor, aRet);
83 if (!bOk)
84 aRet = Outliner::CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor);
86 return aRet;
89 const SdrTextObj* SdrOutliner::GetTextObj() const
91 if( mpTextObj.is() )
92 return static_cast< SdrTextObj* >( mpTextObj.get() );
93 else
94 return 0;
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */