LibreOffice Module svx (master)  1
svdoutl.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #include <svx/svdoutl.hxx>
21 #include <editeng/outliner.hxx>
22 #include <svx/svdotext.hxx>
23 #include <editeng/editstat.hxx>
24 #include <svl/itempool.hxx>
25 #include <editeng/editview.hxx>
26 
27 
29 : Outliner( pItemPool, nMode ),
30  //mpPaintInfoRec( NULL )
31  mpVisualizedPage(nullptr)
32 {
33 }
34 
35 
37 {
38 }
39 
40 
42 {
43  if( pObj && pObj != mpTextObj.get() )
44  {
45  SetUpdateMode(false);
46  OutlinerMode nOutlinerMode2 = OutlinerMode::OutlineObject;
47  if ( !pObj->IsOutlText() )
48  nOutlinerMode2 = OutlinerMode::TextObject;
49  Init( nOutlinerMode2 );
50 
52 
53  EEControlBits nStat = GetControlWord();
54  nStat &= ~EEControlBits( EEControlBits::STRETCHING | EEControlBits::AUTOPAGESIZE );
55  SetControlWord(nStat);
56 
57  Size aMaxSize( 100000,100000 );
59  SetMaxAutoPaperSize( aMaxSize );
60  SetPaperSize( aMaxSize );
61  ClearPolygon();
62  }
63 
64  mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
65 }
66 
68 {
69  mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
70 }
71 
72 OUString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos,
73  std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor)
74 {
75  bool bOk = false;
76  OUString aRet;
77 
78  if(mpTextObj.is())
79  bOk = mpTextObj->CalcFieldValue(rField, nPara, nPos, false, rpTxtColor, rpFldColor, aRet);
80 
81  if (!bOk)
82  aRet = Outliner::CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor);
83 
84  return aRet;
85 }
86 
88 {
89  return mpTextObj.get();
90 }
91 
93 {
94  for (size_t a(0); a < GetViewCount(); a++)
95  {
96  OutlinerView* pOutlinerView = GetView(a);
97 
98  if (pOutlinerView && pOutlinerView->GetEditView().getEditViewCallbacks())
99  {
100  return true;
101  }
102  }
103 
104  return false;
105 }
106 
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetTextObjNoInit(const SdrTextObj *pObj)
Definition: svdoutl.cxx:67
OutlinerMode
void SetPaperSize(const Size &rSize)
EEControlBits
virtual OUString CalcFieldValue(const SvxFieldItem &rField, sal_Int32 nPara, sal_Int32 nPos, std::optional< Color > &rTxtColor, std::optional< Color > &rFldColor)
void SetControlWord(EEControlBits nWord)
OutlinerView * GetView(size_t nIndex) const
virtual bool CalcFieldValue(const SvxFieldItem &rField, sal_Int32 nPara, sal_uInt16 nPos, bool bEdit, std::optional< Color > &rpTxtColor, std::optional< Color > &rpFldColor, OUString &rRet) const
Definition: svdotxfl.cxx:22
SdrOutliner(SfxItemPool *pItemPool, OutlinerMode nMode)
Definition: svdoutl.cxx:28
EEControlBits GetControlWord() const
bool hasEditViewCallbacks() const
Definition: svdoutl.cxx:92
EditView & GetEditView() const
virtual OUString CalcFieldValue(const SvxFieldItem &rField, sal_Int32 nPara, sal_Int32 nPos, std::optional< Color > &rpTxtColor, std::optional< Color > &rpFldColor) override
Definition: svdoutl.cxx:72
const EditViewCallbacks * getEditViewCallbacks() const
uno_Any a
void SetGlobalCharStretching(sal_uInt16 nX=100, sal_uInt16 nY=100)
void reset(reference_type *pReference)
virtual ~SdrOutliner() override
Definition: svdoutl.cxx:36
size_t GetViewCount() const
bool is() const
void SetMaxAutoPaperSize(const Size &rSz)
reference_type * get() const
void SetMinAutoPaperSize(const Size &rSz)
void Init(OutlinerMode nOutlinerMode)
void SetUpdateMode(bool bUpdate)
bool IsOutlText() const
Definition: svdotext.hxx:344
void SetTextObj(const SdrTextObj *pObj)
Definition: svdoutl.cxx:41
const SdrTextObj * GetTextObj() const
Definition: svdoutl.cxx:87
tools::WeakReference< SdrTextObj > mpTextObj
Definition: svdoutl.hxx:32
void ClearPolygon()