Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / svx / source / svdraw / svdoutl.cxx
blobbc7ef835ee75a139ac1d9da7960fc1df77fed655
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include <svx/svdoutl.hxx>
30 #include <editeng/outliner.hxx>
31 #include <svx/svdotext.hxx>
32 #include <editeng/editstat.hxx>
33 #include <svx/svdmodel.hxx>
34 #include <editeng/eeitem.hxx>
35 #include <svl/itempool.hxx>
37 DBG_NAME(SdrOutliner)
39 SdrOutliner::SdrOutliner( SfxItemPool* pItemPool, sal_uInt16 nMode )
40 : Outliner( pItemPool, nMode ),
41 //mpPaintInfoRec( NULL )
42 mpVisualizedPage(0)
44 DBG_CTOR(SdrOutliner,NULL);
48 SdrOutliner::~SdrOutliner()
50 DBG_DTOR(SdrOutliner,NULL);
54 void SdrOutliner::SetTextObj( const SdrTextObj* pObj )
56 if( pObj && pObj != mpTextObj.get() )
58 SetUpdateMode(sal_False);
59 sal_uInt16 nOutlinerMode2 = OUTLINERMODE_OUTLINEOBJECT;
60 if ( !pObj->IsOutlText() )
61 nOutlinerMode2 = OUTLINERMODE_TEXTOBJECT;
62 Init( nOutlinerMode2 );
64 SetGlobalCharStretching(100,100);
66 sal_uIntPtr nStat = GetControlWord();
67 nStat &= ~( EE_CNTRL_STRETCHING | EE_CNTRL_AUTOPAGESIZE );
68 SetControlWord(nStat);
70 Size aNullSize;
71 Size aMaxSize( 100000,100000 );
72 SetMinAutoPaperSize( aNullSize );
73 SetMaxAutoPaperSize( aMaxSize );
74 SetPaperSize( aMaxSize );
75 ClearPolygon();
78 mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
81 void SdrOutliner::SetTextObjNoInit( const SdrTextObj* pObj )
83 mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
86 XubString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos,
87 Color*& rpTxtColor, Color*& rpFldColor)
89 bool bOk = false;
90 XubString aRet;
92 if(mpTextObj.is())
93 bOk = static_cast< SdrTextObj* >( mpTextObj.get())->CalcFieldValue(rField, nPara, nPos, sal_False, rpTxtColor, rpFldColor, aRet);
95 if (!bOk)
96 aRet = Outliner::CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor);
98 return aRet;
101 const SdrTextObj* SdrOutliner::GetTextObj() const
103 if( mpTextObj.is() )
104 return static_cast< SdrTextObj* >( mpTextObj.get() );
105 else
106 return 0;
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */