fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / controller / dialogs / tp_TitleRotation.cxx
blob25fa53dde0b81f61a80059b1d64ec621c55fc7af
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 "tp_TitleRotation.hxx"
22 #include "ResId.hxx"
23 #include "ResourceIds.hrc"
24 #include "chartview/ChartSfxItemIds.hxx"
25 #include "HelpIds.hrc"
27 #include <editeng/eeitem.hxx>
28 #include <editeng/frmdiritem.hxx>
29 #include <svl/intitem.hxx>
31 namespace chart
34 SchAlignmentTabPage::SchAlignmentTabPage(vcl::Window* pWindow,
35 const SfxItemSet& rInAttrs, bool bWithRotation) :
36 SfxTabPage(pWindow, "TitleRotationTabPage","modules/schart/ui/titlerotationtabpage.ui", &rInAttrs)
38 get(m_pCtrlDial,"dialCtrl");
39 get(m_pFtRotate,"degreeL");
40 get(m_pNfRotate,"OrientDegree");
41 get(m_pCbStacked,"stackedCB");
42 get(m_pFtTextDirection,"textdirL");
43 get(m_pLbTextDirection,"textdirLB");
44 get(m_pFtABCD,"labelABCD");
45 m_pCtrlDial->SetText(m_pFtABCD->GetText());
46 m_pOrientHlp = new svx::OrientationHelper(*m_pCtrlDial, *m_pNfRotate, *m_pCbStacked);
48 m_pCbStacked->EnableTriState( false );
49 m_pOrientHlp->Enable( true );
50 m_pOrientHlp->AddDependentWindow( *m_pFtRotate, TRISTATE_TRUE );
52 if( !bWithRotation )
54 m_pOrientHlp->Hide();
58 SchAlignmentTabPage::~SchAlignmentTabPage()
60 disposeOnce();
63 void SchAlignmentTabPage::dispose()
65 delete m_pOrientHlp;
66 m_pOrientHlp = NULL;
67 m_pCtrlDial.clear();
68 m_pFtRotate.clear();
69 m_pNfRotate.clear();
70 m_pCbStacked.clear();
71 m_pFtTextDirection.clear();
72 m_pLbTextDirection.clear();
73 m_pFtABCD.clear();
74 SfxTabPage::dispose();
77 VclPtr<SfxTabPage> SchAlignmentTabPage::Create(vcl::Window* pParent,
78 const SfxItemSet* rInAttrs)
80 return VclPtr<SchAlignmentTabPage>::Create(pParent, *rInAttrs);
83 VclPtr<SfxTabPage> SchAlignmentTabPage::CreateWithoutRotation(vcl::Window* pParent,
84 const SfxItemSet* rInAttrs)
86 return VclPtr<SchAlignmentTabPage>::Create(pParent, *rInAttrs, false);
89 bool SchAlignmentTabPage::FillItemSet(SfxItemSet* rOutAttrs)
91 //Since 04/1998 text can be rotated by an arbitrary angle: SCHATTR_TEXT_DEGREES
92 bool bStacked = m_pOrientHlp->GetStackedState() == TRISTATE_TRUE;
93 rOutAttrs->Put( SfxBoolItem( SCHATTR_TEXT_STACKED, bStacked ) );
95 sal_Int32 nDegrees = bStacked ? 0 : m_pCtrlDial->GetRotation();
96 rOutAttrs->Put( SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
98 SvxFrameDirection aDirection( m_pLbTextDirection->GetSelectEntryValue() );
99 rOutAttrs->Put( SvxFrameDirectionItem( aDirection, EE_PARA_WRITINGDIR ) );
101 return true;
104 void SchAlignmentTabPage::Reset(const SfxItemSet* rInAttrs)
106 const SfxPoolItem* pItem = GetItem( *rInAttrs, SCHATTR_TEXT_DEGREES );
108 sal_Int32 nDegrees = pItem ? static_cast<const SfxInt32Item*>(pItem)->GetValue() : 0;
109 m_pCtrlDial->SetRotation( nDegrees );
111 pItem = GetItem( *rInAttrs, SCHATTR_TEXT_STACKED );
112 bool bStacked = pItem && static_cast<const SfxBoolItem*>(pItem)->GetValue();
113 m_pOrientHlp->SetStackedState( bStacked ? TRISTATE_TRUE : TRISTATE_FALSE );
115 if( rInAttrs->GetItemState(EE_PARA_WRITINGDIR, true, &pItem) == SfxItemState::SET)
116 m_pLbTextDirection->SelectEntryValue( SvxFrameDirection(static_cast<const SvxFrameDirectionItem*>(pItem)->GetValue()) );
119 } //namespace chart
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */