xref: /aoo42x/main/svx/source/svdraw/svdoutl.cxx (revision 7a980842)
1f6e50924SAndrew Rist /**************************************************************
2f6e50924SAndrew Rist  *
3f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5f6e50924SAndrew Rist  * distributed with this work for additional information
6f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10f6e50924SAndrew Rist  *
11f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17f6e50924SAndrew Rist  * specific language governing permissions and limitations
18f6e50924SAndrew Rist  * under the License.
19f6e50924SAndrew Rist  *
20f6e50924SAndrew Rist  *************************************************************/
21f6e50924SAndrew Rist 
22f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir #include <svx/svdoutl.hxx>
27cdf0e10cSrcweir #include <editeng/outliner.hxx>
28cdf0e10cSrcweir #include <svx/svdotext.hxx>
29cdf0e10cSrcweir #include <editeng/editstat.hxx>
30cdf0e10cSrcweir #include <svx/svdmodel.hxx>
31cdf0e10cSrcweir #include <editeng/eeitem.hxx>
32cdf0e10cSrcweir #include <svl/itempool.hxx>
33cdf0e10cSrcweir 
DBG_NAME(SdrOutliner)34cdf0e10cSrcweir DBG_NAME(SdrOutliner)
35cdf0e10cSrcweir /*************************************************************************
36cdf0e10cSrcweir |*
37cdf0e10cSrcweir |* Ctor
38cdf0e10cSrcweir |*
39cdf0e10cSrcweir \************************************************************************/
40cdf0e10cSrcweir SdrOutliner::SdrOutliner( SfxItemPool* pItemPool, sal_uInt16 nMode )
41cdf0e10cSrcweir :	Outliner( pItemPool, nMode ),
42cdf0e10cSrcweir 	//mpPaintInfoRec( NULL )
43cdf0e10cSrcweir 	mpVisualizedPage(0)
44cdf0e10cSrcweir {
45cdf0e10cSrcweir     DBG_CTOR(SdrOutliner,NULL);
46cdf0e10cSrcweir }
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 
49cdf0e10cSrcweir /*************************************************************************
50cdf0e10cSrcweir |*
51cdf0e10cSrcweir |* Dtor
52cdf0e10cSrcweir |*
53cdf0e10cSrcweir \************************************************************************/
~SdrOutliner()54cdf0e10cSrcweir SdrOutliner::~SdrOutliner()
55cdf0e10cSrcweir {
56cdf0e10cSrcweir     DBG_DTOR(SdrOutliner,NULL);
57cdf0e10cSrcweir }
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 
60cdf0e10cSrcweir /*************************************************************************
61cdf0e10cSrcweir |*
62cdf0e10cSrcweir |*
63cdf0e10cSrcweir |*
64cdf0e10cSrcweir \************************************************************************/
SetTextObj(const SdrTextObj * pObj)65cdf0e10cSrcweir void SdrOutliner::SetTextObj( const SdrTextObj* pObj )
66cdf0e10cSrcweir {
67cdf0e10cSrcweir 	if( pObj && pObj != mpTextObj.get() )
68cdf0e10cSrcweir 	{
69cdf0e10cSrcweir 		SetUpdateMode(sal_False);
70cdf0e10cSrcweir 		sal_uInt16 nOutlinerMode2 = OUTLINERMODE_OUTLINEOBJECT;
71cdf0e10cSrcweir 		if ( !pObj->IsOutlText() )
72cdf0e10cSrcweir 			nOutlinerMode2 = OUTLINERMODE_TEXTOBJECT;
73cdf0e10cSrcweir 		Init( nOutlinerMode2 );
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 		SetGlobalCharStretching(100,100);
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 		sal_uIntPtr nStat = GetControlWord();
78cdf0e10cSrcweir 		nStat &= ~( EE_CNTRL_STRETCHING | EE_CNTRL_AUTOPAGESIZE );
79cdf0e10cSrcweir 		SetControlWord(nStat);
80cdf0e10cSrcweir 
81cdf0e10cSrcweir 		Size aNullSize;
82cdf0e10cSrcweir 		Size aMaxSize( 100000,100000 );
83cdf0e10cSrcweir 		SetMinAutoPaperSize( aNullSize );
84cdf0e10cSrcweir 		SetMaxAutoPaperSize( aMaxSize );
85cdf0e10cSrcweir 		SetPaperSize( aMaxSize );
86cdf0e10cSrcweir 		ClearPolygon();
87cdf0e10cSrcweir 	}
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 	mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
90cdf0e10cSrcweir }
91cdf0e10cSrcweir 
92cdf0e10cSrcweir /*************************************************************************
93cdf0e10cSrcweir |*
94cdf0e10cSrcweir |*
95cdf0e10cSrcweir |*
96cdf0e10cSrcweir \************************************************************************/
SetTextObjNoInit(const SdrTextObj * pObj)97cdf0e10cSrcweir void SdrOutliner::SetTextObjNoInit( const SdrTextObj* pObj )
98cdf0e10cSrcweir {
99cdf0e10cSrcweir 	mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
100cdf0e10cSrcweir }
101cdf0e10cSrcweir 
102cdf0e10cSrcweir /*************************************************************************
103cdf0e10cSrcweir |*
104cdf0e10cSrcweir |*
105cdf0e10cSrcweir |*
106cdf0e10cSrcweir \************************************************************************/
CalcFieldValue(const SvxFieldItem & rField,sal_uInt32 nPara,sal_uInt16 nPos,Color * & rpTxtColor,Color * & rpFldColor)107*7a980842SDamjanJovanovic XubString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, sal_uInt32 nPara, sal_uInt16 nPos,
108cdf0e10cSrcweir                                      Color*& rpTxtColor, Color*& rpFldColor)
109cdf0e10cSrcweir {
110cdf0e10cSrcweir 	FASTBOOL bOk = sal_False;
111cdf0e10cSrcweir 	XubString aRet;
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	if(mpTextObj.is())
114cdf0e10cSrcweir 		bOk = static_cast< SdrTextObj* >( mpTextObj.get())->CalcFieldValue(rField, nPara, nPos, sal_False, rpTxtColor, rpFldColor, aRet);
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 	if (!bOk)
117cdf0e10cSrcweir 		aRet = Outliner::CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor);
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 	return aRet;
120cdf0e10cSrcweir }
121cdf0e10cSrcweir 
GetTextObj() const122cdf0e10cSrcweir const SdrTextObj* SdrOutliner::GetTextObj() const
123cdf0e10cSrcweir {
124cdf0e10cSrcweir 	if( mpTextObj.is() )
125cdf0e10cSrcweir 		return static_cast< SdrTextObj* >( mpTextObj.get() );
126cdf0e10cSrcweir 	else
127cdf0e10cSrcweir 		return 0;
128cdf0e10cSrcweir }
129