/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include #include #include #include #include #include SfxPoolItem* SvxZoomItem::CreateDefault() { return new SvxZoomItem; } constexpr OUString ZOOM_PARAM_VALUE = u"Value"_ustr; constexpr OUString ZOOM_PARAM_VALUESET = u"ValueSet"_ustr; constexpr OUString ZOOM_PARAM_TYPE = u"Type"_ustr; #define ZOOM_PARAMS 3 SvxZoomItem::SvxZoomItem ( SvxZoomType eZoomType, sal_uInt16 nVal, TypedWhichId _nWhich ) : SfxUInt16Item( _nWhich, nVal, SfxItemType::SfxZoomItemType ), nValueSet( SvxZoomEnableFlags::ALL ), eType( eZoomType ) { } SvxZoomItem* SvxZoomItem::Clone( SfxItemPool * /*pPool*/ ) const { return new SvxZoomItem( *this ); } bool SvxZoomItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); const SvxZoomItem& rItem = static_cast(rAttr); return ( GetValue() == rItem.GetValue() && nValueSet == rItem.GetValueSet() && eType == rItem.GetType() ); } bool SvxZoomItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const { nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { case 0: { css::uno::Sequence< css::beans::PropertyValue > aSeq{ comphelper::makePropertyValue(ZOOM_PARAM_VALUE, sal_Int32( GetValue() )), comphelper::makePropertyValue(ZOOM_PARAM_VALUESET, sal_Int16( nValueSet )), comphelper::makePropertyValue(ZOOM_PARAM_TYPE, sal_Int16( eType )) }; assert(aSeq.getLength() == ZOOM_PARAMS); rVal <<= aSeq; break; } case MID_VALUE: rVal <<= static_cast(GetValue()); break; case MID_VALUESET: rVal <<= static_cast(nValueSet); break; case MID_TYPE: rVal <<= static_cast(eType); break; default: OSL_FAIL("sfx2::SvxZoomItem::QueryValue(), Wrong MemberId!"); return false; } return true; } bool SvxZoomItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) { nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { case 0: { css::uno::Sequence< css::beans::PropertyValue > aSeq; if (( rVal >>= aSeq ) && ( aSeq.getLength() == ZOOM_PARAMS )) { sal_Int32 nValueTmp( 0 ); sal_Int16 nValueSetTmp( 0 ); sal_Int16 nTypeTmp( 0 ); bool bAllConverted( true ); sal_Int16 nConvertedCount( 0 ); for (const auto& rProp : aSeq) { if ( rProp.Name == ZOOM_PARAM_VALUE ) { bAllConverted &= ( rProp.Value >>= nValueTmp ); ++nConvertedCount; } else if ( rProp.Name == ZOOM_PARAM_VALUESET ) { bAllConverted &= ( rProp.Value >>= nValueSetTmp ); ++nConvertedCount; } else if ( rProp.Name == ZOOM_PARAM_TYPE ) { bAllConverted &= ( rProp.Value >>= nTypeTmp ); ++nConvertedCount; } } if ( bAllConverted && nConvertedCount == ZOOM_PARAMS ) { SetValue( static_cast(nValueTmp) ); nValueSet = static_cast(nValueSetTmp); eType = static_cast(nTypeTmp); return true; } } return false; } case MID_VALUE: { sal_Int32 nVal = 0; if ( rVal >>= nVal ) { SetValue( static_cast(nVal) ); return true; } else return false; } case MID_VALUESET: case MID_TYPE: { sal_Int16 nVal; if ( rVal >>= nVal ) { if ( nMemberId == MID_VALUESET ) nValueSet = static_cast(nVal); else if ( nMemberId == MID_TYPE ) eType = static_cast(nVal); return true; } else return false; } default: OSL_FAIL("sfx2::SvxZoomItem::PutValue(), Wrong MemberId!"); return false; } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ >distro/collabora/viewer LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-09-18.NET Bindings: Native bridge for .NETRMZeroFour
This patch includes all marshalling and proxy handling code on the .NET side as well as the native side needed for a fully functional UNO bridge. It also includes some changes and corrections to net_basetypes and netmaker needed for the bridge to work properly. It also includes the FirstUnoContact example in C# as demonstration. Change-Id: I406932938a4415d24408fb41ddfa7d8eeb5d1f94 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170916 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2024-09-18.NET Bindings: Create nuget package for LO SDKRMZeroFour
This patch includes: 1. CustomTarget to build and place the LibreOffice.Bindings NuGet package in <sdk>/dotnet/ 2. net_bridge (.NET library) to declare bootstrap() on the C# side, and net_bootstrap (C++ library) to wrap bootstrap() on the native side 3. Changes to LO SDK scripts to find .NET SDK and DOTNET_ROOT on the users machine Change-Id: Ia29ae56a2ad0f808f1563ef6167a3bd7c476642e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170172 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2024-08-14.NET Bindings: Fix netmaker and net_basetypesRMZeroFour
This commit makes a few misc. fixes to netmaker and net_basetypes - Renamed css.uno.Exception to css.uno.UnoException to avoid name conflicts with System.Exception - Added a new css.uno.Any constructor and setValue function that deduces the type of the any from given object at runtime - Changed the AnyTests unit tests to match changes made to css.uno.Any - Removed the in keyword from UNO 'in' parameters. Was a premature optimisation that might have a negative effect for certain types. - Generated struct and exception field members were not marked public earlier by accident, fixed. - Generted struct and exception constructors had parameters in order opposite to expected, fixed. - Generated services tried to instantiate the interface, not the service earlier, fixed. Change-Id: Ia63f9db469db13a5d01617617095b8f568b39c72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171706 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2024-08-03.NET Bindings: Add DotnetTest class to gbuildRMZeroFour
This commit adds the DotnetTest gbuild class to build a unit test suite using the .NET SDK and the NUnit testing framework. Also adds a DotnetTest target for the net_ure module, with unit tests for the Any type, as well as some minor changes to the Any type that came about when writing the test cases. Change-Id: Idbc08ac8f0736dd7355092dd1e69a5f1b4137c4c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168956 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2024-08-03.NET Bindings: Move built .NET libraries into instdirRMZeroFour
This commit adds Package targets for the net_basetypes, net_uretypes and net_oootypes libraries to install them into instdir/program/dotnet. Also adds a LIBO_SHARE_DOTNET_FOLDER variable mirroring the LIBO_SHARE_JAVA_FOLDER variable. Change-Id: I28cdb2dac799bd72d11c3e550bba1a946db8b49c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170098 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2024-08-03.NET Bindings: Improve DotnetLibrary gbuild classRMZeroFour
This commit rewrites the DotnetLibrary gbuild class to build a .NET library. Logic for handling various .NET languages is now consolidated, while earlier there were separate functions for each language. Usage has been made much more similar to the Jar gbuild class. The CustomTargets used to build net_uretypes and net_oootypes have also been reworked, and a function has been added to DotnetLibrary to consume sources generated by a custom target, for cleaner usage. Change-Id: Ie494b2547d30c43f9bb0aedeac4d140f1f3a830b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170168 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2024-06-27.NET Bindings: Remove absolute path check in DotnetLibraryRMZeroFour
This commit removes the gb_DotnetLibrary__ensure_absolute gbuild function that was breaking out-of-source directory builds. Code using that function was changed to accept already absolute paths as arguments. Change-Id: I6d9d3dac33e296cf0e69910f16564d822047857e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169353 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-06-25align conditional re dotnet/netmaker - only use in --enable-odk caseChristian Lohmaier
that's what the check for creating the tool used already (Module_codemaker.mk), while the targets using the tool only was behind a ENABLE_DOTNET check. fixes the android CI builds Change-Id: Ie859a6409bb523926a619e87b693ec4c17a875cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169512 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Jenkins
2024-06-19.NET Bindings: Add netmaker (.NET codemaker)RMZeroFour
This commit adds the netmaker executable to the codemaker/ module, to generate C# code from UNOIDL specifications. Also adds some Makefiles in the net_ure/ directory to generate code for udkapi and offapi, to build the net_uretypes and net_oootypes assemblies. Change-Id: Ifb61fe6a0f8f594eaa6ff95b025ba57f247b0d4b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168710 Tested-by: Jenkins Tested-by: Hossein <hossein@libreoffice.org> Reviewed-by: Hossein <hossein@libreoffice.org>